#include <bits/stdc++.h>
#include<unordered_set>

#define ll long long
#define ull unsigned long long
#define uint unsigned int

#define YES cout << "YES" << '\n'
#define NO cout << "NO" << '\n'
#define endl '\n'
const int INF = 1e9;
const int MOD = 998244353;
using namespace std;
int gcd(int a, int b)
{
    a = abs(a);
    b = abs(b);
    if (a == 0)
        return b;
    if (b == 0)
        return a;
    if (a < 1000000 && b < 1000000)
    {
        int temp;
        while (b != 0)
        {
            temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }
    int shift = 0;
    while (((a | b) & 1) == 0)
    {
        a >>= 1;
        b >>= 1;
        shift++;
    }
    while ((a & 1) == 0)
        a >>= 1;
    while (b != 0)
    {
        while ((b & 1) == 0)
            b >>= 1;
        if (a > b)
        {
            int temp = a;
            a = b;
            b = temp;
        }
        b = b - a;
    }
    return a << shift;
}
int lcm(int a, int b)
{
    return a / gcd(a, b) * b;
}
/*思考

*/

void solve()
{
    int n;
    cin >> n;
    
    vector<int> a(n);
    int ans = 0;
    unordered_set<int> s;
    unordered_set<int> s_temp;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for(int i=0; i<n; i++){
        s.insert(a[i]);
        s_temp.insert(a[i]);
        if(s_temp.size() == s.size()){
            ans++;
            s.clear();
        }
    }
    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 0;
    cin >> t;
    while (t--)
        solve();
    return 0;
}